package com.uwo.commons.configuration.aop.validate;

/**
 * 错误代码
 * @author hao.yan
 */
public enum ErrorCode {

    MISSING_FIELD(10001, "Missing %s field"),

    PARAM_EMPTY(10002, "The parameter %s is empty"),

    FORMAT_ERROR(10003, "%s format error"),

    MIN_LENGTH(10004, "The minimum length of %s is %d"),

    MAX_LENGTH(10005, "The maximum length of %s is %d"),

    LESS_THAN(10006, "The %s value is less than %d"),

    GREATER_THAN(10007, "The %s value is greater than %d"),

    SENSITIVE_WORD_ERROR(10072, "Sensitive characters in %s"),

    SYSTEM_ERROR(10091, "System error, Please read the logs!"),
    ;

    private ErrorCode(int code, String message){
        this.code = code;
        this.message = message;
    }

    private int code;

    private String message;

    public int getCode() {
        return code;
    }

    public String getMessage(Object... args) {
        return String.format(message, args);
    }

}
